home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / e / gencodee_v21.lha / GenCodeE / E / DemoGenCodeE30b / GUI.em < prev   
Text File  |  1994-11-15  |  6KB  |  195 lines

  1. OPT MODULE
  2.  
  3.  
  4. /*/////////////////////////////////////////////////////////////////////////////
  5. ///////////////////////////////////////////////////////////// Macro files /////
  6. ///////////////////////////////////////////////////////////////////////////////
  7. MACROS 'MUI.pma'
  8. */
  9.  
  10.  
  11. ->/////////////////////////////////////////////////////////////////////////////
  12. ->////////////////////////////////////////////////////// External modules /////
  13. ->/////////////////////////////////////////////////////////////////////////////
  14. MODULE 'muimaster' , 'libraries/mui'
  15. MODULE 'tools/boopsi'
  16. MODULE 'utility/tagitem' , 'utility/hooks'
  17.  
  18.  
  19. ->/////////////////////////////////////////////////////////////////////////////
  20. ->//////////////////////////////////////////////////// Object definitions /////
  21. ->/////////////////////////////////////////////////////////////////////////////
  22. EXPORT OBJECT app_arexx
  23.     commands :    PTR TO mui_command
  24.     error    :    hook
  25. ENDOBJECT
  26.  
  27. EXPORT OBJECT app_display
  28.     button_pressed          :    hook
  29. ENDOBJECT
  30.  
  31. EXPORT OBJECT app_obj
  32.     app                     :    PTR TO LONG
  33.     wi_the_window           :    PTR TO LONG
  34.     bt_put_constant_string  :    PTR TO LONG
  35.     bt_put_variable         :    PTR TO LONG
  36.     bt_return_id            :    PTR TO LONG
  37.     bt_call_hook            :    PTR TO LONG
  38.     tx_result               :    PTR TO LONG
  39.     bt_quit                 :    PTR TO LONG
  40.     stR_TX_result           :    PTR TO CHAR
  41. ENDOBJECT
  42.  
  43.  
  44. ->/////////////////////////////////////////////////////////////////////////////
  45. ->////////////////////////////////////////////////// Constant definitions /////
  46. ->/////////////////////////////////////////////////////////////////////////////
  47. EXPORT ENUM
  48.     ID_BUTTON_PRESSED = 1
  49.  
  50.  
  51. ->/////////////////////////////////////////////////////////////////////////////
  52. ->/////////////////////////////////////////// Global variable definitions /////
  53. ->/////////////////////////////////////////////////////////////////////////////
  54. EXPORT DEF string_var
  55.  
  56.  
  57. ->/////////////////////////////////////////////////////////////////////////////
  58. ->/////////// Creates one instance of one object or the whole application /////
  59. ->/////////////////////////////////////////////////////////////////////////////
  60. PROC create( display : PTR TO app_display ,
  61.              icon  = NIL ,
  62.              arexx = NIL : PTR TO app_arexx ,
  63.              menu  = NIL ) OF app_obj
  64.  
  65.     DEF grOUP_ROOT_0C , gr_grp_0 , gr_grp_1 , la_result , gr_grp_2
  66.  
  67.     self.stR_TX_result           := 'Zzzzzzzzzzzzz'
  68.  
  69.     self.bt_put_constant_string := SimpleButton( 'Put _Constant String' )
  70.  
  71.     self.bt_put_variable := SimpleButton( 'Put _Variable' )
  72.  
  73.     self.bt_return_id := SimpleButton( '_Return ID' )
  74.  
  75.     self.bt_call_hook := SimpleButton( 'Call _Hook' )
  76.  
  77.     la_result := Label( 'Result' )
  78.  
  79.     self.tx_result := TextObject ,
  80.         MUIA_HelpNode , 'TX_result' ,
  81.         MUIA_Background , MUII_TextBack ,
  82.         MUIA_Frame , MUIV_Frame_Text ,
  83.         MUIA_Text_Contents , self.stR_TX_result ,
  84.         MUIA_Text_PreParse , '\el' ,
  85.         MUIA_Text_SetMin , MUI_TRUE ,
  86.     End
  87.  
  88.     gr_grp_1 := GroupObject ,
  89.         MUIA_Group_Horiz , MUI_TRUE ,
  90.         Child , la_result ,
  91.         Child , self.tx_result ,
  92.     End
  93.  
  94.     gr_grp_0 := GroupObject ,
  95.         MUIA_Frame , MUIV_Frame_Group ,
  96.         MUIA_FrameTitle , 'Click !' ,
  97.         Child , self.bt_put_constant_string ,
  98.         Child , self.bt_put_variable ,
  99.         Child , self.bt_return_id ,
  100.         Child , self.bt_call_hook ,
  101.         Child , gr_grp_1 ,
  102.     End
  103.  
  104.     self.bt_quit := SimpleButton( '_Quit' )
  105.  
  106.     gr_grp_2 := GroupObject ,
  107.         Child , self.bt_quit ,
  108.     End
  109.  
  110.     grOUP_ROOT_0C := GroupObject ,
  111.         Child , gr_grp_0 ,
  112.         Child , gr_grp_2 ,
  113.     End
  114.  
  115.     self.wi_the_window := WindowObject ,
  116.         MUIA_Window_Title , 'The window !' ,
  117.         MUIA_HelpNode , 'WI_the_window' ,
  118.         MUIA_Window_ID , "0WIN" ,
  119.         WindowContents , grOUP_ROOT_0C ,
  120.     End
  121.  
  122.     self.app := ApplicationObject ,
  123.         ( IF icon THEN MUIA_Application_DiskObject ELSE TAG_IGNORE ) , icon ,
  124.         ( IF arexx THEN MUIA_Application_Commands ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.commands ELSE NIL ) ,
  125.         ( IF arexx THEN MUIA_Application_RexxHook ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.error ELSE NIL ) ,
  126.         ( IF menu THEN MUIA_Application_Menu ELSE TAG_IGNORE ) , menu ,
  127.         MUIA_Application_Author , 'Lionel Vintenat' ,
  128.         MUIA_Application_Base , 'DEMOGENCODEE' ,
  129.         MUIA_Application_Title , 'DemoGenCodeE' ,
  130.         MUIA_Application_Version , '$VER: DemoGenCodeE 1.0 (01.09.94)' ,
  131.         MUIA_Application_Copyright , 'Public Domain !' ,
  132.         MUIA_Application_Description , 'Application example for GenCodeE' ,
  133.         SubWindow , self.wi_the_window ,
  134.     End
  135.  
  136. ENDPROC self.app
  137.  
  138.  
  139. ->/////////////////////////////////////////////////////////////////////////////
  140. ->////////////////////////// Disposes the object or the whole application /////
  141. ->/////////////////////////////////////////////////////////////////////////////
  142. PROC dispose() OF app_obj IS ( IF self.app THEN Mui_DisposeObject( self.app ) ELSE NIL )
  143.  
  144.  
  145. ->/////////////////////////////////////////////////////////////////////////////
  146. ->/////////////////////// Initializes all the notifications of one object /////
  147. ->/////////////////////////////////////////// or of the whole application /////
  148. ->/////////////////////////////////////////////////////////////////////////////
  149. PROC init_notifications( display : PTR TO app_display ) OF app_obj
  150.  
  151.     domethod( self.bt_put_constant_string , [
  152.         MUIM_Notify , MUIA_Pressed , FALSE ,
  153.         self.tx_result ,
  154.         3 ,
  155.         MUIM_Set , MUIA_Text_Contents , 'Constant string put !' ] )
  156.  
  157.     domethod( self.bt_put_variable , [
  158.         MUIM_Notify , MUIA_Pressed , FALSE ,
  159.         self.tx_result ,
  160.         3 ,
  161.         MUIM_Set , MUIA_Text_Contents , string_var ] )
  162.  
  163.     domethod( self.bt_return_id , [
  164.         MUIM_Notify , MUIA_Pressed , FALSE ,
  165.         self.app ,
  166.         2 ,
  167.         MUIM_Application_ReturnID , ID_BUTTON_PRESSED ] )
  168.  
  169.     domethod( self.bt_call_hook , [
  170.         MUIM_Notify , MUIA_Pressed , FALSE ,
  171.         self.app ,
  172.         2 ,
  173.         MUIM_CallHook , display.button_pressed ] )
  174.  
  175.     domethod( self.bt_quit , [
  176.         MUIM_Notify , MUIA_Pressed , FALSE ,
  177.         self.app ,
  178.         2 ,
  179.         MUIM_Application_ReturnID , MUIV_Application_ReturnID_Quit ] )
  180.  
  181.     domethod( self.wi_the_window , [
  182.         MUIM_Window_SetCycleChain , self.bt_put_constant_string ,
  183.         self.bt_put_variable ,
  184.         self.bt_return_id ,
  185.         self.bt_call_hook ,
  186.         self.bt_quit ,
  187.         0 ] )
  188.  
  189.     set( self.wi_the_window ,
  190.         MUIA_Window_Open , MUI_TRUE)
  191.  
  192. ENDPROC
  193.  
  194.  
  195.